from typing import *


class Solution:

    def rob(self, nums: List[int]) -> int:
        s, p = nums[0], 0
        for i in range(1, len(nums)):
            num = nums[i]
            cs = p + num
            cp = max(s, p)
            s, p = cs, cp
        return max(s, p)
